﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using LibNiconico.NiconicoApi.Internal;

namespace LibNiconico.NiconicoApi.PlayerStatus
{
    /// <summary>
    /// ニコニコプレイヤーステータス
    /// </summary>
    public sealed partial class NicoPlayerStatus
    {
        /// <summary>
        /// ストリーム
        /// </summary>
        public InternalClasses.Stream Stream { get; private set; }

        /// <summary>
        /// ユーザ情報
        /// </summary>
        public InternalClasses.User User { get; private set; }

        /// <summary>
        /// RTMP情報
        /// </summary>
        public InternalClasses.Rtmp Rtmp { get; private set; }

        /// <summary>
        /// メッセージサーバ情報
        /// </summary>
        public InternalClasses.MessageServer Ms { get; private set; }

        /// <summary>
        /// Twitter関連情報
        /// </summary>
        public InternalClasses.Twitter Twitter { get; private set; }

        internal NicoPlayerStatus() 
        {
            this.Stream = new InternalClasses.Stream();
            this.User = new InternalClasses.User();
            this.Rtmp = new InternalClasses.Rtmp();
            this.Ms = new InternalClasses.MessageServer();
            this.Twitter = new InternalClasses.Twitter();
        }

        internal static NicoPlayerStatus Parse(XElement element)
        {
            return new NicoPlayerStatus
            {
                Stream = InternalClasses.Stream.Parse(element),
                User = InternalClasses.User.Parse(element),
                Rtmp = InternalClasses.Rtmp.Parse(element),
                Ms = InternalClasses.MessageServer.Parse(element),
                Twitter = InternalClasses.Twitter.Parse(element)
            };
        }
    }
}
